package com.greedy.bulls.stock.common.system.service.impl;

import com.greedy.bulls.stock.common.system.dao.ITradeGlobalConfigDao;
import com.greedy.bulls.stock.common.system.service.ITradeGlobalConfigService;
import com.greedy.bulls.stock.entity.system.TradeGlobalConfig;
import com.greedy.bulls.stock.entity.system.TradeSeq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: Yanxy
 * @Date: Created in:2023-07-30
 * Description: 全局系统配置实现类
 */
@Service
public class TradeGlobalConfigServiceImpl implements ITradeGlobalConfigService {


    @Autowired
    private ITradeGlobalConfigDao tradeGlobalConfigDao;

    /**
     * 根据编号获取全局系统配置信息
     *
     * @param code 编号
     * @return 全局系统配置对象
     */
    @Override
    public TradeGlobalConfig getTradeGlobalConfigByCode(String code) {
        return tradeGlobalConfigDao.getByCode(code);
    }

    /**
     * 获取指定序列增长ID
     *
     * @param code 编号
     * @return 序列ID
     */
    @Override
    public Long getNextSeqId(String code) {
        TradeSeq seq = new TradeSeq();
        seq.setCode(code);
        tradeGlobalConfigDao.getNextId(seq);
        return seq.getNextId();
    }
}
